import http from '@/utils/request'
/**
 * 获取所有角色列表
 */
export const reqGetRoleList = (page, pagesize = 10) => {
  return http({
    method: 'get',
    url: '/sys/role',
    params: {
      page,
      pagesize
    }
  })
}

/** *
 * 新增角色
 * ***/
export function reqAddRole(data) {
  return http({
    url: '/sys/role',
    data,
    method: 'post'
  })
}

/**
 * 删除角色
 */
export const reqDelRole = (id) => {
  return http({
    method: 'delete',
    url: `/sys/role/${id}`
  })
}

/**
 * 根据id获取角色详情
 */
export const reqGetRoleDetail = (id) => {
  return http({
    method: 'get',
    url: `/sys/role/${id}`
  })
}

/**
 * 更新角色详情(form中需要有id以及其他信息)
 */
export const reqUpdateRole = (form) => {
  return http({
    method: 'put',
    url: '/sys/role/' + form.id,
    data: form
  })
}

